using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour
{

    [SerializeField] private Transform Player;
    private Vector3 offset;
    void Start()
    {
        var camera = Camera.main;
        offset = camera.transform.position - Player.transform.position;
    }

    // Update is called once per frame
    void LateUpdate()
    {
        var initPos = Camera.main.transform.position;
        var targetPos = Player.transform.position + offset;
        Camera.main.transform.position = Vector3.Lerp(initPos,targetPos,Time.deltaTime);
    }
}
